
class Entity {


// PARAMETERS
  final color defaultColor = color(200, 50, 50);
  final float defaultSize = 1.0;

  // how much outside of the screen an Entity can be
  // and still get rendered
  final float renderMarginal = 200.0;
// PARAMETERS END


// MEMBERS
  public color c;
  public float size;
  public Particle p;

  boolean alwaysDraw = false;
// END MEMBERS


  public float x() {
    return absx();
//    return zoom * p.position().x() + width/2;
  }

  public float absx() { return p.position().x(); }
  public float absy() { return p.position().y(); }
  public float absz() { return p.position().z(); }

  public float y() {
    return absy();
//    return zoom * p.position().y() + height/2;
  }

  public float z() {
    return absz();
  }

  public Entity(Particle p) {
    defaultSettings();
    this.p = p;
  }

  public Entity() {
    defaultSettings();
  }

  public void defaultSettings() {
    size = defaultSize;
    c = defaultColor; 
  }

  public void drawMicro() {
  }

  public void drawMacro() {
  }

  public boolean outsideClip() {
    float x = x() - panx;
    float y = y() - pany;

    float clipBoxW = (width/2 + renderMarginal)/zoom;
    float clipBoxH = (height/2 + renderMarginal)/zoom;

    if( (x < -clipBoxW) || (x > clipBoxW))
      return true;

    if( (y < -clipBoxH) || (y > clipBoxH))
      return true;

    return false;
  }

  public void draw() {
    if(outsideClip()) return;

    if(zoom < macroZoom)
      drawMacro();
    else
      drawMicro();
  }
}
